package com.fbinggun.fbinggunutil.price;


import org.black_ixx.playerpoints.PlayerPoints;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;

/**
 * 点券价格
 */
public class PointsPrice implements IPrice{
    int price;
    public PointsPrice(ConfigurationSection config) {
        this.price=config.getInt("Price");
    }

    @Override
    public PriceType getType() {
        return PriceType.Points;
    }

    @Override
    public boolean has(Player player) {
    int points=  PlayerPoints.getInstance().getAPI().look(player.getUniqueId());
    if(points>=getPrice()){
        return true;
    }
        return false;
    }

    @Override
    public boolean take(Player player) {
        PlayerPoints.getInstance().getAPI().take(player.getUniqueId(),getPrice());
        return false;
    }
    public int getPrice() {
        return price;
    }
}
